package model

import "github.com/zeromicro/go-zero/core/stores/sqlx"

var _ PoetModel = (*customPoetModel)(nil)

type (
	// PoetModel is an interface to be customized, add more methods here,
	// and implement the added methods in customPoetModel.
	PoetModel interface {
		poetModel
		withSession(session sqlx.Session) PoetModel
	}

	customPoetModel struct {
		*defaultPoetModel
	}
)

// NewPoetModel returns a model for the database table.
func NewPoetModel(conn sqlx.SqlConn) PoetModel {
	return &customPoetModel{
		defaultPoetModel: newPoetModel(conn),
	}
}

func (m *customPoetModel) withSession(session sqlx.Session) PoetModel {
	return NewPoetModel(sqlx.NewSqlConnFromSession(session))
}
